#ifndef GAMEBOARDSOLVER_H
#define GAMEBOARDSOLVER_H

#include <QThread>
#include <QObject>
#include <QList>
#include "GameBoard.h"

class GameBoardSolver : public QThread
{
  Q_OBJECT
  public:
    GameBoardSolver(GameBoard* board);
    virtual ~GameBoardSolver();
    void setParameters( float clusterSize, float choicesLeft, float columnHeight,
                        float singletons, float histogram);
    virtual bool solve();
    void run();
    const QList<GameBoard::Choice>& getChoices() const;
    const unsigned long long& getNumBackTracks() const;

  signals:
    void done(bool solved);

  protected:
    virtual bool recursiveSolve(GameBoard *board);
    virtual void scoreAndSortChoices(QList<GameBoard::Choice>& choices);

  protected:
    GameBoard *mOriginalBoard, *mCurrentBoard;
    QList<GameBoard::Choice> mChoicesMade;
    unsigned long long mBackTracks;
    float mClusterSize, mChoicesLeft, mColumnHeight, mSingletons, mHistogram;
};

#endif // GAMEBOARDSOLVER_H
